<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Category extends Model
{
	use SoftDeletes;

    protected $table = 'category';

    //批量赋值设置
    protected $fillable = ['category_name','pid'];

	/**
	 * 一对多关联文章
	 * User: ihome
	 * @return \Illuminate\Database\Eloquent\Relations\HasMany
	 */
	public function article()
	{
		return $this->hasMany(Article::class,'category_id','id');
	}
}
